package test4_9.demo06;

public class Homework20_8 {

    public static int binarySearch(int[] nums,int v,int start,int end){

        if(end<start){
            return 0;
        }

        int mid = (start+end)/2;
        if (nums[mid] == v){
            return mid;
        }else if(nums[mid] < v){
            return binarySearch(nums,v,mid+1,end);
        }else {
            return binarySearch(nums,v,start,mid-1);
        }
    }

    public static void main(String[] args) {
        int[] nums={1,2,4,5,6,8,9,12,23,45,67,68,79,80,90,200};
        System.out.println(binarySearch(nums,6,0,10));

    }
}
